package com.zx.wx.utils;

import com.zx.wx.wxInterface.Request;

/**
 * @author：朱笑    
 * @note：
 * @date：2016年9月3日 
 */
public class AccountUtils {
	/**
	 * @author：朱笑    
	 * @note：生成二维码
	 * @date：2016年9月3日 
	 * @参考url:http://mp.weixin.qq.com/wiki/18/167e7d94df85d8389df6c94a7a8f78ba.html
	 */
	public static class QRCode{
		/**
		 *@note: 创建临时二维码	
		 *@date: 2016年9月3日 下午2:39:00
		 *@param access_token
		 *@param expire_seconds 该二维码有效时间，以秒为单位。 最大不超过2592000（即30天），此字段如果不填，则默认有效期为30秒。
		 *@param scene_id 场景值ID，临时二维码时为32位非0整型
		 *@param request
		 *@return
		 */
		public String tempQRCode(String access_token,String expire_seconds,String scene_id,Request request){
			String url="https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token="+access_token;
			String json="{\"expire_seconds\": "+expire_seconds+", \"action_name\": \"QR_SCENE\", \"action_info\": {\"scene\": {\"scene_id\": "+scene_id+"}}}";
			String result=request.doPost(url, json);
			return result;
		}
		/**
		 *@note: 	
		 *@date: 2016年9月3日 下午2:46:08
		 *@param access_token
		 *@param scene_id 场景值，永久二维码时最大值为100000（目前参数只支持1--100000）
		 *@param request
		 *@return
		 */
		public String getQRCode(String access_token,String scene_id,Request request){
			String url="https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token="+access_token;
			String json="{\"action_name\": \"QR_LIMIT_SCENE\", \"action_info\": {\"scene\": {\"scene_id\":"+scene_id+"}}}";
			String result=request.doPost(url, json);
//			{"ticket":"gQH47joAAAAAAAAAASxodHRwOi8vd2VpeGluLnFxLmNvbS9xL2taZ2Z3TVRtNzJXV1Brb3ZhYmJJAAIEZ23sUwMEmm3sUw==","expire_seconds":60,"url":"http:\/\/weixin.qq.com\/q\/kZgfwMTm72WWPkovabbI"}
			return result;
		}
		/**
		 *@note: 	
		 *@date: 2016年9月3日 下午3:27:12
		 *@param ticket
		 *@param request
		 *@return
		 */
		public String ticketToQRCode(String ticket,Request request){
			String url="https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket="+ticket;
			String result=request.doGet(url);
			return result;
		}
	}
}

/*
 * 
 *  蕾姆老婆，not bug
 *                             .   .....:;iri;.                               
 *                              ;;irrss1r..;ri:.                            
 *                       .,:.   , ,181,:.  :SS55hs;.                        
 *                     .:h1. .  ,;iSGh:. .,:,i393Shr:.                      
 *                   .. ,38Shr,ihSS5535:,;1sr5G3iirir;:.                    
 *                     ;hSSSS55S55555SS33SS3GXGs...  ir:,.                  
 *               . .; .riihh115555SSSSS555ris5Sr.,::i11i;:,                 
 *               iSs;,;::r;:;srrr111sshsiii;;;hhir1;;iS31s1i                
 *             . ;s.,;,,r:,:i:::;;;;;;ir;;;;i11rS39h5938G993h;              
 *               ,.,:,,i:,:i:::;;;;;;;;riir1S31s159859G139399h,             
 *           ..,,.,:,,;;::i;:;;;;;;;;i;s55Shr1Ssrs888SX9SGXX835;            
 *           . ,:.:,,:i::ii:;;;i;;;;;si;h93i;sS1r5S8988&XXG89951            
 *             ,..:,,r;::sr;;;rriiii;hs:ssS3ri3359h9XGG&AXGG89Sh.           
 *             : ::.,s::;hs;;;s1r;iir31;r::58hh8388GG8GX&&G9999s.           
 *             ;.r;.i1;:;S5;;;hSs;ii181i:..,iSS989398&8X&GXX8G9r.           
 *            .r,11,s51;i33ri;581iir531h8XX83S5S89S8X898&GSG&85r.           
 *            :1;h3;s9SiiS951i59hrrh5h5&GHA#@@#&99998h1h9Gh399h;.           
 *            ,1s18hh99hs583S1hSh1h5hh:,.ih#MAG5S9333sirSG539isr            
 *            ,r519953355533S555h5Ssi: . :h11;ir5SSs5r;;SSS95 :i.           
 *             ;1SS8SSS15551155515s,  ..,,;iiris5Ss;r;rh9sSh, . :           
 *             .i5399885rssri;iii;. ....,,::;;;r1iihhh985i1:    ,.          
 *               i5S99X&5;;;:,...,........,,,,::,i38hh5r;:.,    ..          
 *                :rh3988s,,,,.................,r35iir. .  .                
 *     .,.         .,::r11;,........;;.......:r5;:. .                       
 *    .,,:,               ..........,,....:i1555i:                          
 *    :;;:;,      .            iri;:,.,;r155h1rhsr                          
 *    ,;iii;       ,, ...   .,:s155S555SSh1shsrrsi                          
 *    ,,::;is: ... .ii ,,    .:i:iiir1hi:;irsiiisr:                         
 *   ,,::;;ih5: ....:r. ,,     :iii;;i;,,;iiiiiiiii;.            ....  .:;: 
 *   :;;iir1hh1,     .;i..:,     ,i159X3S1;;;;;;ii;;;,.,,,,  .:;:,.  .ih1r: 
 *   ,rrirs1hir1;  ..,8@i ,;,. .r1hss95X1SSi.,,::;;iiii:::.;r;;.    :h5hsi. 
 *    :i;iir:.;i;. . i&5ir; .;.98r;;ri;&3 ;3h ..;;i;i..;::1r,      ;55h1r,  
 *      :;ii.,;: .. :5i,;i;;r:ihs;;irrrhG3;85,:,;:.,ii,&8r:  . ;s.i51sr;:   
 *      ,r1r, ,, ,:ir:,,...,,;s::::;;iisr8Ah i,;:i:ii;:X9;,...;55h5siii;:   
 *       ihi  ..,i1i::,...   :;,,:ri;iii1si;;;:::,::::,9r  ..;sssh5hh1sr;   
 *    . .,;,   irsr;;,,....,,;..,,:;;;r;ri.....   ..,:,5r.  .i;i;:55hh1s;   
 *    ,,       ihi;:.       ,:....i;.,:,15:;,......,,,,i;...ii::..5511si    
 *   .., 1,   s5;:,.       ,:....;:... hXi,       ,:;;:si;ih5:, :5:;1;     
 *   .:SX3B3  .A8;:,.      ,i.....i: ...sS:        .,;issi,.s1r.:;. ;.      
 *   :8HHH&As.8HXr;:.     .;i .  ;h,...;:5:        .,:i1Sssrr;i.,. ,        
 *    1XAA&&&X&X&8r;;,. iS::;. .i11r,.::5&5        .,;r11rii;ii;   ,.       
 *     S&AHAAA&&&AXSsri5Hhrs:.:h5hh5s:i;GHHh,    ..,;isS;S:;;S8:1&1. .      
 *     1XX&&&&AAAHB#A89H9,i;;1&BM##MHi.9&HGGA1,::;;iisGHGHi SAA9XHBASr:.    
 *    .5X&AAAAHBBHHAH8XHh:ii1sH@HAB#B,iH&B9XHH3srrshSXH&A&GSA&XA&AHHHXs.    
 *     hGX&AHHBHHHAAAXSH&s.r5hSM@5,195.5H&A9A&AAX8&HBM&&&&&&A&&&&HBHA8i      
 *   ,9X&AAAA&&A&&A&89A&5:Sh1A@M&XHMh:8AHG8H&&&AHHBHHHAAAAAHHHBBMHX1.       
 *   sXAHA&&&AA&&H&&88&&S,sh3M#M#@MMG,9AAX8H&&A&&&&&AMMBHAAAAAHAA&r         
 *  ,9&HA&&AA&&&HA&H3&&Xiih1X@MBHXH#G 3H&X8H&&AA&AAAAABBHHAAAAA&8s          
 *  rG&&&AHA&&&HA&H&3AAS 1hhG#BM8:hh:i&H&88H&&&AA&AAAHAHHAHAAA&Xh           
 *  iGG&AH&&&&AHAHHSGAHs:h19B#BB&XH5,;AHASXHA&&&HA&AAAH&AHHBAA&G1           
 *  ,9X&A&&&&&HHHHGSAAA, sh8#MBBBMM@r 8HASGHHHA&AHA&&AHA&AHHBAX8:           
 *   hX&&&&&&&HHHA8SAHG:ih15M#BBMMM&i;SHH98AHHHHHHHA&&HHAAHBBAX5            
 *   .sSG&&&AHHHA&X5AH3 i1SGB#MXS&H.,:8AAG3AAHHAAHHHA&AHA&ABBAXi            
 *      .3AHBHHA&&&S&AG:1h3A###Sr5Gr.,XAAX3A&AHHAAHHHHAHHAAHBAG:            
 *     :h&HHHHH&&AH8GA&:s55M@##M###M::AAAX8A&&AHHAAAHHHHBHAHHAS             
 *   ;5XBBMMBHAAAHH38&Ass539GAHMMMMh:1HAA8GA&&&AHA&&&AHHBBHH&S  
 */